﻿@namespace Blazorise.Docs.Docs.Examples

<Markdown Value="@markdownValue" ValueChanged="@OnMarkdownValueChanged" PreviewRender="@PreviewRender" />

@code {
    string markdownValue = "# EasyMDE \n Go ahead, play around with the editor! Be sure to check out **bold**, *italic*, [links](https://google.com) and all the other features. You can type the Markdown syntax, use the toolbar, or use shortcuts like `ctrl-b` or `cmd-b`.";

    Task OnMarkdownValueChanged( string value )
    {
        markdownValue = value;

        return Task.CompletedTask;
    }

    protected Task<string> PreviewRender( string plainText )
    {
        return Task.FromResult( Markdig.Markdown.ToHtml( markdownValue ?? string.Empty ) );
    }
}